<?php


namespace App\Http\Controllers\cms;


use App\Engine\BaseController;
use Illuminate\Support\Facades\Log;
use function app\Utils\go;

class Table extends BaseController
{
    /**添加数据
     * @return array
     * @throws \Illuminate\Validation\ValidationException
     */
    public function insert()
    {
        Log::error($this->post);
        $this->validate($this->request,$this->table->getRule(),$this->table->getRuleMessage());
        return go($this->table->insert());
    }
    /**更新数据
     * @return array
     * @throws \Illuminate\Validation\ValidationException
     */
    public function update()
    {
        $this->validate($this->request,$this->table->getRule(),$this->table->getRuleMessage());
        return go($this->table->update());
    }

    /**删除数据
     * @return array
     */
    public function del()
    {
        return go($this->table->del());
    }

    /**获取数据
     * @return array
     */
    public function get()
    {
        return go($this->table->get());
    }

    public function get_all()
    {
        return go($this->table->get_all());
    }
}
